Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pass valid locale for number formatting [DHIS2-17709] #1352

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

tomzemp
Copy link
Member

@tomzemp tomzemp commented Jul 5, 2024

See https://dhis2.atlassian.net/jira/software/c/projects/DHIS2/issues/DHIS2-17709

Before
image

After
image

Tests

Automated: The app has no automated tests, so I'm not adding any with this PR 🤠
Manual: Tested app with various languages. Because of the existing logic of the number formatting, it is only applied on some number and there are some surprising variations:

  • variants of Arabic (e.g. Arabic (Sudan)) return Arabic formatted numbers (e.g. ٢٠٠٬٠٠٠ instead of 200,000), but Arabic itself returns 200,000. I checked with Alaa and she said in Sudan, they're used interchangeably; in Egypt people prefer ٢٠٠٬٠٠٠)
  • Bangla returns with Bengali numerals. (not sure if this is expected or not, and I don't know of Bengali speakers to ask for confirmation.
    In both cases, I think it's probably okay to leave with what we have here, rather than make (additional) arbitrary exceptions.

also manually tested the parseLocale function that was added to return language-locale, e.g. some results:

> parseLocale(undefined)
'en'
> parseLocale(null)
'en'
> parseLocale('pt_BR')
'pt-BR'
> parseLocale('tet')
'tet'
> parseLocale('pt-BR-Cyrl')
'pt-BR'
> parseLocale('uz_UZ-Cyrl')
'uz-UZ'
> parseLocale('uz_UZ_Cyrl')
'uz-UZ'
> parseLocale('fr')
'fr'

@dhis2-bot
Copy link
Contributor

🚀 Deployed on https://pr-1352--dhis2-settings.netlify.app

@tomzemp tomzemp requested a review from a team July 5, 2024 09:30
Copy link
Contributor

@KaiVandivier KaiVandivier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@tomzemp tomzemp merged commit 460a87a into master Jul 15, 2024
9 checks passed
@tomzemp tomzemp deleted the DHIS2-17709/language-crash branch July 15, 2024 06:56
dhis2-bot added a commit that referenced this pull request Jul 15, 2024
## [100.2.1](v100.2.0...v100.2.1) (2024-07-15)

### Bug Fixes

* pass valid locale for number formatting [DHIS2-17709] ([#1352](#1352)) ([460a87a](460a87a))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 100.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants